package lanceur;

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;

import rmi.Groupe;
import rmi.ServeurRmiInterfaceImp;

public class Serveur  {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
    
    public static void main(String [] args) 
    {
    	try {
			// Set properties
		    Hashtable<String,String> env = new Hashtable<String,String>(11);
	
		    // Definition of the jndi server
		    env.put(Context.INITIAL_CONTEXT_FACTORY,
			    "com.sun.jndi.rmi.registry.RegistryContextFactory");
		    env.put(Context.PROVIDER_URL, "rmi://localhost:2999");
	
		    // Get the initial context
	        Context ctx = new InitialContext(env);
	        Groupe groupe = new Groupe();
	        ServeurRmiInterfaceImp rmiImp=new ServeurRmiInterfaceImp(groupe);
		    ctx.rebind("serveur",rmiImp) ;
	
		    System.out.println("Serveur pret...."); 
		    
		}
		catch (Exception re) {
		    
		    System.out.println("Exception 1 " + re) ; 
		}
    }

}
